<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
#huhu{
    width: 500px;
            height: 100px;
            border: 2px solid rosybrown;
}
</style>
<body>
    <button onclick="fn()">肥龙神</button>
    <div id="huhu">

    </div>
    <script>
        var a=0
        function fn() {
        if (a==0) {
            a++;
            var hu=document.getElementById('huhu')
            var newH2 = document.createElement('h2');
            var txt = document.createTextNode('封校三天 快乐无边');
            newH2.appendChild(txt);
            hu.appendChild(newH2);
        }else{
            var hu=document.getElementById('huhu')
            hu.innerText=''
            a--;
           
        }
       
        }
    </script>
</body>
</html>